<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('农户收入信息填写')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>户编号：</label>
                            <input type="text" name="fid"/>
                        </li>
                        <li>
                            <label>户主姓名：</label>
                            <input type="text" name="name"/>
                        </li>
                        <li>
                            <label>证件号码：</label>
                            <input type="text" name="idCard"/>
                        </li>
                        <li>
                            <label>年度：</label>
                            <input type="text" name="reportYear"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;查询</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:info:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:info:remove')}]];
    var natureVillageDatas = [[${@dict.getType('base_nature_village')}]];
    var prefix = ctx + "system/info";

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            checkUrl: prefix + "/check/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "收入信息",
            columns: [
                {
                    field: 'id',
                    title: 'ID'
                },
                {
                    field: 'fid',
                    title: '户编号',
                },
                {
                    field: 'name',
                    title: '户主姓名'
                },
                {
                    field: 'idCard',
                    title: '证件号码'
                },
                {
                    field: 'natVillage',
                    title: '自然村',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(natureVillageDatas, value);
                    }
                },
                {
                    field: 'reportYear',
                    title: '年度'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        console.log(row.sealState)
                        var actions = [];
                        if (row.sealState == 0) {
                            //录入
                            actions.push('<a class="btn btn-success btn-xs ' + '" href="javascript:void(0)" onclick="editTab(\'' + row.id + '\')"><i class="fa fa-edit"></i>录入</a> ');
                        } else {
                            //查看
                            actions.push('<a class="btn btn-success btn-xs ' + '" href="javascript:void(0)" onclick="checkTab(\'' + row.id + '\')"><i class="fa fa-edit"></i>查看</a> ');
                        }
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
        $.table.hideColumn('id');//id列不展示
    });

    // 修改信息，以tab页展现
    editTab = function (id) {
        table.set();
        $.modal.parentTab("收入信息填写", $.operate.editUrl(id));
    }
    // 查看信息，以tab页展现
    checkTab = function (id) {
        table.set();
        $.modal.parentTab("收入信息查看", $.operate.checkUrl(id));
    }
</script>
</body>
</html>
